package OBSXML;

import java.util.ArrayList;

/**
 * Konfigurationslæser til DB server
 *
 * @Author Børge Bergstrøm
 */
public class DBServerCONF extends XML{
    private String dBdbms = null;
    private String dBHost = null;
    private int dBPort = 0;
    private String dBName = null;
    private String dBUsername = null;
    private String dBPassword = null;
    private ArrayList<String> dbConfFileReader = ReadXMLFile();

    /**
     * Indlæser konfigurationsfil fra parametre
     *
     * @param path
     * @param XMLFileName
     */
    public DBServerCONF(String path, String XMLFileName)
    {
        super(path, XMLFileName);
        dBdbms = dbConfFileReader.get(0);
        dBHost = dbConfFileReader.get(1);
        dBPort = Integer.parseInt(dbConfFileReader.get(2));
        dBName = dbConfFileReader.get(3);
        dBUsername = dbConfFileReader.get(4);
        dBPassword = dbConfFileReader.get(5);
    }

    /**
     * Henter databasetype
     *
     * @return String
     */
    public String getDBdbms() {
        return dBdbms;
    }

    /**
     * Henter databasehosten
     *
     * @return String
     */
    public String getDBHost() {
        return dBHost;
    }

    /**
     * Henter portnummer til databasen
     *
     * @return int
     */
    public int getDBPort() {
        return dBPort;
    }

    /**
     * Henter databasens navn
     *
     * @return String
     */
    public String getDBName() {
        return dBName;
    }

    /**
     * Henter loginnavn
     *
     * @return String
     */
    public String getDBUsername() {
        return dBUsername;
    }

    /**
     * Henter loginpassword
     *
     * @return String
     */
    public String getDBPassword() {
        return dBPassword;
    }
}